#include"thread_pool.hpp"
#include"task.hpp"
#include<unistd.h>

typedef function<void()> task_t;

int main()
{
    ThreadPool<task_t>* t=ThreadPool<task_t>::GetInstance();
    t->Start();
    TaskManger task;//任务模块

    int n=15;
    while (n--)
    {
        t->PushTask(task.GetTask());//随机生成任务,进行模拟
    }

    t->Stop();

    t->Wait();

    cout<<"所有线程回收成功"<<endl;


    cout<<"下一玻测试："<<endl;
    sleep(2);

    t->Start();

    n=15;
    while (n--)
    {
        t->PushTask(task.GetTask());//随机生成任务,进行模拟
    }

    t->Stop();

    t->Wait();

    return 0;
}